﻿using System;
using System.Collections;
using System.Linq;

namespace _2.randomNumSort
{
    class Program
    {
        static void Main(string[] args)
        {
            Random rd = new Random();
            int[] arr = new int [100];
            for(int i = 0; i < 100; ++i)
            {
                arr[i]=rd.Next(0,1000);
            }

            var arrSorted = from num in arr orderby num select num;
            int arrSum = arrSorted.Sum();
            double arrAver = arrSorted.Average();
            Console.WriteLine("排序后的数组为：");
            foreach(int num in arrSorted)
            {
                Console.Write(num + " ");
            }
            Console.WriteLine();
            Console.WriteLine("数组的和为：" + arrSum);
            Console.WriteLine("数组的平均值为：" + arrAver);

        }
    }
}
